<?php
$this->lang->load('template');
?>
<form action="" method="post">
  <input type="hidden" name="redirect" value="<?=getUrl(false);?>" />
  <input type="hidden" name="category[id]" value="<?=isset($category['id'])?$category['id']:''?>" />
  <p>
    <label>分类名称</label>
    <span class="required">*</span> <br />
    <input name="category[name]" size="30" type="text" value="<?=isset($category['name'])?$category['name']:''?>" />
  </p>
  <p>
    <label>分类描述</label>
    <br />
    <input name="category[description]" size="30" type="text" value="<?=isset($category['description'])?$category['description']:''?>" />
  </p>
  <p>
    <label>分类类型</label>
    <br />
    <select name="category[type]" style="width:200px">
      <option value="system">系统</option>
	  <?php 
	  foreach($cates as $key=>$cate):
	  ?>
      <option value="<?=$key?>" <?php if( isset($category['type']) && $key==$category['type']):?> selected="selected"<?php endif;?>>
	  	<?=$cate?>
      </option>
      <?php endforeach;?>
    </select>
  </p>
  <p>
    <label>上级分类</label>
    <br />
    <select name="category[parent_id]" style="width:200px">
      <option value="0">请选择</option>
      <?php 
	  foreach($categories as $cate):
	  if( isset($category['id']) && $cate['id']==$category['id'] ){	//删除自己
		  continue;
	  }
	  ?>
      <option value="<?=$cate['id']?>"  <?php if(isset($category['id']) && $cate['id']==$category['parent_id']):?> selected="selected"<?php endif;?>>
	  <?=str_repeat('--',$cate['level'])?>
	  <?=$cate['name']?>
	  </option>
      <?php endforeach;?>
    </select>
  </p>
  <p>
    <label>排序</label>
    <br />
    <input name="category[sorts]" size="30" type="text" value="<?=isset($category['sorts'])?$category['sorts']:0?>" />
  </p>
  <!-- 
  <p>
    <label>显示模板文件（系统view目录下）</label>
    <br />
    <input name="category[display_temp]" size="30" type="text" value="<?=$category['display_temp']?>" />
  </p>
  <p>
    <label>自定义风格CSS文件</label>
    <br />
    <input name="category[display_css]" size="30" type="text" value="<?=$category['display_css']?>" />
  </p>
   -->
  <p>
    <label>是否显示</label>
    <br />
    <input type="radio" name="category[status]" value="1" checked="checked" />
    是
    <input type="radio" name="category[status]" value="0"<?php if( isset($category['status']) && $category['status']==0):?> checked="checked"<?php endif;?>  />
    否 </p>
  <p class="form-buttons">
  		<button type="submit"><span><?=$this->lang->line('tpl_submit')?></span></button>
      <a href="<?=getUrl(false);?>"><?=$this->lang->line('tpl_cancel')?></a> </p>
</form>
